package com.example.homemodule.view.ui;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.examination.mlib.constants.ARouterConstants;
import com.example.homemodule.R;
import com.example.homemodule.databinding.DoctorHealthDataBinding;
import com.example.homemodule.utils.HomeUtils;
import com.example.homemodule.viewmodel.DoctorHealthViewModel;
import com.yilijk.base.base.BaseActivity;
import com.zzhoujay.richtext.ImageHolder;
import com.zzhoujay.richtext.RichText;

import org.json.JSONException;
import org.json.JSONObject;

@Route(path = ARouterConstants.Home.DoctorHealthActivity)
public class DoctorHealthActivity extends BaseActivity<DoctorHealthViewModel, DoctorHealthDataBinding> {

    @Autowired
    public int id;
    @Autowired
    public boolean showInfo = true;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_doctor_health;
    }

    @Override
    protected void processLogic() {
        binding.titleBar.setTitle("医生健康号");
        mViewModel.initViewModel(this,binding);
        binding.healthDoctorCardInfo.setVisibility(showInfo?View.VISIBLE:View.GONE);
        mViewModel.initView();
        mViewModel.initData(id);

    }

    @Override
    protected void dispostData() {

    }

    @RequiresApi(api = Build.VERSION_CODES.M)
    @Override
    protected void setListener() {
        mViewModel.initListener();
    }

    @Override
    public void onClick(View v) {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("pageName","HealthDetails");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        HomeUtils.sendBrocast(this, "ReceiveRefreshKey", jsonObject.toString());

    }
}